package order;

import cn.hutool.json.JSON;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.ms.education.JwtUtils;
import com.ms.education.order.OrderApplication;
import com.ms.education.order.entity.Order;
import com.ms.education.order.entity.eo.Course;
import com.ms.education.order.mapper.OrderMapper;
import com.ms.education.order.service.OrderService;
import com.mysql.jdbc.TimeUtil;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.math.BigDecimal;
import java.util.concurrent.TimeUnit;

/**
 * <p>Project:education-test
 * <p>Powered by ms on 2023-02-16 18:54:48
 *
 * @author ms
 * @version 1.0
 * @since 1.8
 */
@SpringBootTest(classes = OrderApplication.class)
public class test {

    @Autowired
    private OrderService orderService;

    @Autowired
    private OrderMapper orderMapper;

    @Test
    public void testAddOrder() {
        Order order = new Order();
        order.setOrderNo("00");
        order.setCourseId(111);
        order.setUserId(1);
        orderService.save(order);
    }

    @org.junit.Test
    public void testJson() {
        String token = JwtUtils.getJwtToken("701");
        System.out.println(token);
    }

    @org.junit.Test
    public void testMoney(){
        System.out.println(TimeUnit.SECONDS);
        System.out.println(TimeUnit.MINUTES);
        System.out.println(TimeUnit.HOURS);
        System.out.println(TimeUnit.DAYS);
    }
    @Test
    public void testDeleteExpiredOrder(){
        TimeUnit minutes = TimeUnit.MINUTES;

        System.out.println("=========================="+orderMapper.deleteExpiredOrder(2,0));
    }
}
